home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / sgml / unix / sgmlh / etype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-03  |  3.9 KB  |  71 lines

  1. /******************************************************************************/
  2. /* ETYPE.H: Definitions for element type and group processing.
  3. */
  4. #define MCHARS    0x80        /* Model: contains #CHARS. */
  5. #define MGI       0x40        /* Model: contains GI names. */
  6. #define MPHRASE   0x20        /* Model: first token is #CHARS. */
  7. #define MKEYWORD  0x1F        /* Model: defined with single keyword. */
  8. #define MNONE     0x10        /* Model: contains no GIs or #CHARS. */
  9. #define MANY      0x08        /* Model: contains any GIs or #CHARS. */
  10. #define MRCDATA   0x04        /* Model: contains RCDATA. */
  11. #define MCDATA    0x02        /* Model: contains CDATA. */
  12.  
  13. #define TOREP (TOPT+TREP)     /* 11000000 Optional and repeatable. */
  14. #define TOPT      0x80        /* Token: 1=optional; 0=required. */
  15. #define TREP      0x40        /* Token: 1=repeatable; 0=not. */
  16. #define TTMASK    0x0F        /* 00001111 Mask for testing token type. */
  17. #define TTETD        4        /* 00000100 Token is an ETD. */
  18. #define TTAND        3        /* 00000011 Token is an AND group. */
  19. #define TTSEQ        2        /* 00000010 Token is a sequence group. */
  20. #define TTOR         1        /* 00000001 Token is an OR group. */
  21. #define TTCHARS      0        /* 00000000 Token is #CHARS. */
  22.  
  23. struct thdr {                 /* Token header or model header. */
  24.      UNCH ttype;              /* Token type attributes or model content. */
  25.      union {
  26.           int tnum;           /* Group token or ghdr: tokens in group. */
  27.           struct etd *thetd;  /* GI token: ptr to etd. */
  28.      } tu;
  29. };
  30. #define THSZ (sizeof(struct thdr))
  31.  
  32. #define ETDHASH   53          /* Est. 200 entries in etd hash table (etdtab). */
  33. #define SMO       0x40        /* ETDMIN: Start-tag O minimization. */
  34. #define EMO       0x04        /* ETDMIN: End-tag O minimization. */
  35. #define ETDDCL    0x80        /* ETDMIN: Element was declared. */
  36. #define ETDUSED   0x20        /* ETDMIN: Element used in another declaration. */
  37. #define ETDOCC    0x10        /* ETDMIN: Element occurred in document. */
  38. struct etd {                  /* Element type definition. */
  39.      struct etd *etdnext;     /* Next element type definition in hash chain. */
  40.      UNCH etdgi[NAMELEN+2];   /* GI preceded by its length, followed by EOS. */
  41.      UNCH etdmin;             /* Flag bits: minimization. */
  42.      struct thdr *etdmod;     /* Content model. */
  43.      struct etd **etdmex;     /* Minus exceptions. */
  44.      struct etd **etdpex;     /* Plus exceptions. */
  45.      struct ad *adl;          /* Attribute descriptor list. */
  46.      struct entity **etdsrm;  /* Short reference map. */
  47.      UNIV etdstag;            /* User start-tag data (long pointer). */
  48.      UNIV etdetag;            /* User end-tag data (long pointer). */
  49. };
  50. #define ETDSZ (sizeof(struct etd))
  51. typedef struct etd *PETD;
  52.  
  53. struct mpos {                 /* Position of current element in model. */
  54.      UNCH g;                  /* Index of this group in the model. */
  55.      UNCH t;                  /* Index of the current token in this group. */
  56.      long h;                  /* Hit bits of this group's tokens (GRPCNT==32).*/
  57. };
  58.  
  59. #define TAGCONER  0x01        /* 00000001 (contersw) Tag was out of context. */
  60. #define TAGNET    0x02        /* 00000010 (etisw)    Tag has NET enabled. */
  61. #define TAGPEX    0x04        /* 00000100 (pexsw)    Tag was plus exception. */
  62. #define TAGREF    0x08        /* 00001000 (conrefsw) Tag had CONREF or EMPTY.*/
  63. struct tag {                  /* Tag control block. */
  64.      UNCH   status;           /* Status of context check. */
  65.      UNCH   tflags;           /* Flags: TAGCONER TAGNET TAGPEX TAGREF */
  66.      struct etd *tetd;        /* Element type definition for tag. */
  67.      struct entity **tsrm;    /* Current short reference map. */
  68.      struct mpos tpos[GRPLVL+1]; /* Position of next tag in this model. */
  69. };
  70. /******************************************************************************/
  71.